<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui, viewport-fit=cover">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>My App</title>
    <link rel="stylesheet" href="../../packages/core/css/framework7.min.css">
  </head>
  <body>
    <div id="app">
      <div class="view view-main view-init">
        <div class="page">
          <div class="navbar">
            <div class="navbar-inner">
              <div class="left"></div>
              <div class="title">Notifications</div>
              <div class="right"></div>
            </div>
          </div>
          <div class="page-content">
            <div class="block">
              <p><a class="button button-raised open-full" href="#">Full-layout notification</a></p>
              <p><a class="button button-raised open-with-button" href="#">With close button</a></p>
              <p><a class="button button-raised open-click-to-close" href="#">Click to close</a></p>
              <p><a class="button button-raised open-callback-on-close" href="#">Callback on close</a></p>
            </div>
          </div>
        </div>
      </div>
    </div>
    <script type="text/javascript" src="../../packages/core/js/framework7.min.js"></script>
    <script>
      var theme = 'ios';
      if (location.href.indexOf('theme=md') >= 0) theme = 'md';
      var plugin = {
        params: {
          theme: theme,
          root: '#app',
        }
      };
      if (Framework7.use) Framework7.use(plugin);
      else if (Framework7.Class && Framework7.Class.use) Framework7.Class.use(plugin);
      
    </script>
    <style>
      .demo-icon {
        background: #EE350F;
        color: #fff;
        border-radius: 50%;
        text-align: center;
      }
    </style>
    <script>
      var app = new Framework7();
      
      var $$ = Dom7;
      
      // Create full-layout notification
      var notificationFull = app.notification.create({
        icon: '<i class="icon demo-icon">7</i>',
        title: 'Framework7',
        titleRightText: 'now',
        subtitle: 'This is a subtitle',
        text: 'This is a simple notification message',
        closeTimeout: 3000,
      });
      
      // Create notification with close button
      var notificationWithButton = app.notification.create({
        icon: '<i class="icon demo-icon">7</i>',
        title: 'Framework7',
        subtitle: 'Notification with close button',
        text: 'Click (x) button to close me',
        closeButton: true,
      });
      
      // Create notification with click to close
      var notificationClickToClose = app.notification.create({
        icon: '<i class="icon demo-icon">7</i>',
        title: 'Framework7',
        titleRightText: 'now',
        subtitle: 'Notification with close on click',
        text: 'Click me to close',
        closeOnClick: true,
      })
      
      // With callback on close
      var notificationCallbackOnClose = app.notification.create({
        icon: '<i class="icon demo-icon">7</i>',
        title: 'Framework7',
        titleRightText: 'now',
        subtitle: 'Notification with close on click',
        text: 'Click me to close',
        closeOnClick: true,
        on: {
          close: function () {
            app.dialog.alert('Notification closed');
          },
        },
      });
      
      // Open Notifications
      $$('.open-full').on('click', function () {
        notificationFull.open();
      });
      $$('.open-with-button').on('click', function () {
        notificationWithButton.open();
      });
      $$('.open-click-to-close').on('click', function () {
        notificationClickToClose.open();
      });
      $$('.open-callback-on-close').on('click', function () {
        notificationCallbackOnClose.open();
      });
    </script>
  </body>
</html>